import {PasteProps} from "@/components/right-click-menu/index.vue";

export type PrimaryKey = 'fullPath' | 'id'

export interface FileInterface {
    id?: string
    size: number
    path: string
    filename: string
    fullPath: string
    directory: boolean
}

export interface HeaderProps {
    isDirTree: boolean
    isPath: boolean
    isSearch: boolean|undefined
    home: string
    path: string|undefined
    keyword: string
    searchSource: Array<FileInterface>|undefined
    breadcrumbs: Array<BreadcrumbItemProps>
    history: HistoryPathProps
    onChangeDirTree: () => void
    onInitPath:(path: string|undefined, homePath?: string) => void
    onSearch:() => void
    onClickPathItem: (key: string) => void
    onPathInputStatus: (status: boolean) => void
    onSearchInputStatus: (status: boolean|undefined) => void
    onSearchInputFocus: () => void
    onNavigate: (direction: 'backward' | 'forward') => void
}

interface BreadcrumbItemProps {
    path: string
    label: string
}

interface HistoryPathProps {
    stack: Array<string>
    index: number
}

export interface DirTreeProps {
    loading: boolean
    data: Array<FileInterface>
    dirProps: object
    onCurrentChange: (data: FileInterface, node: any) => void
}


export interface FileTableProps {
    loading: boolean
    editRow: EditRowProps
    dataSource: Array<FileInterface>
    selections: Array<any>
    selectionKeys: Array<any>
    onLoadData: (ph?: string) => any
    onReloadData: () => void
    onRowClick: (row?: any) => void
    onRowDblClick: (row: any) => void
    onSelectionChange: (rows: any) => void
    onRowContextmenu: (row: any, column: any, event: MouseEvent) => void
    onRowClassName: (data: { row: never, rowIndex: number }) => void
    onCreateFolder: (path: string) => void
    onEditFilename:(row: any) => void
    onRename:(row?: any) => void
    onPaste: (path: string, data: PasteProps) => void
    onUpload: (path?: string) => void
    onDownload: (path: string, rows: any[]) => void
    onDelete: (path: string, rows: any[]) => void
}

export interface EditRowProps {
    id?: string
    fullPath?: string
    filename?: string
}
